const LOCAL_CLIENT_KEY = "local_client";

// 还要再创建一个自定义配置的类
// 比如，是否开启自动下载，

// 存储数据
const saveClient = (client) => {
    try {
        localStorage.setItem(LOCAL_CLIENT_KEY, JSON.stringify(client));
    } catch (error) {
        console.error('Error saving client:', error);
    }
};

// 获取数据
const getClient = () => {
    try {
        const value = localStorage.getItem(LOCAL_CLIENT_KEY);
        return value ? JSON.parse(value) : null;
    } catch (error) {
        console.error('Error getting client:', error);
        return null;
    }
};

// 删除数据
const delClient = () => {
    try {
        localStorage.removeItem(LOCAL_CLIENT_KEY);
    } catch (error) {
        console.error('Error deleting client:', error);
    }
};

// 导出函数
export { saveClient, getClient, delClient };